package config

import (
	"github.com/spf13/viper"
	"log"
)

type Mysql struct {
	Host     string
	Port     string
	User     string
	Password string
	Database string
}

type AppConfog struct {
	Mysql
}

var AppConF AppConfog

func Init() {
	viper.SetConfigFile("config/dev.yaml")
	err := viper.ReadInConfig()
	if err != nil {
		return
	}
	err = viper.Unmarshal(&AppConF)
	if err != nil {
		return
	}
	log.Println("动态读取配置成功", AppConF)
}
